//
//  NSMutableAttributedString+LJJAttributeHelper.m
//  shopTest
//
//  Created by 梁佳佳 on 2016/11/21.
//  Copyright © 2016年 梁佳佳. All rights reserved.
//

#import "NSMutableAttributedString+LJJAttributeHelper.h"

@implementation NSMutableAttributedString (LJJAttributeHelper)

+ (NSMutableAttributedString *)makeListPriceText:(NSString *)fromString oldPrice:(NSString *)backPrice
{
    //当前价格(需要手动添加人民币符号)
    NSString *nowPrice = [NSString stringWithFormat:@"%@ ",fromString];
    NSMutableAttributedString *string = [[NSMutableAttributedString alloc]initWithString:nowPrice attributes:@{NSForegroundColorAttributeName:RGB(230, 51, 37, 1),NSFontAttributeName:[UIFont boldSystemFontOfSize:16.0]}];
    //过去价格
    NSString *oldString = [NSString stringWithFormat:@"%@ ",backPrice];
    NSMutableAttributedString *oldPrice = [[NSMutableAttributedString alloc]initWithString:oldString attributes:@{NSForegroundColorAttributeName:RGB(132, 132, 132, 1),NSFontAttributeName:[UIFont systemFontOfSize:11.0],NSStrikethroughStyleAttributeName:@(2)}];
    [string insertAttributedString:oldPrice atIndex:string.length];
    return string;
}

@end
